<?php

use think\migration\Migrator;
use think\migration\db\Column;

class Deposit extends Migrator
{
    public function up()
    {
        $table = $this->table('deposit',array('comment' => '会员资金表'));
        $table->addColumn('user_id', 'integer', array('comment' => '会员id'))
              ->addColumn('amount', 'integer', array('default' => 0, 'comment' => '金额'))
              ->addColumn('types', 'string', array('limit' => 9, 'comment' => '资金类型'))
              ->addColumn('created_at', 'timestamp', array('default' => 'CURRENT_TIMESTAMP'))
              ->addColumn('updated_at', 'timestamp', array('null' => true))
              ->addIndex('id')
              ->addIndex('user_id')
              ->save();   
    }
    public function down()
    {
        $this->dropTable('deposit');
    }
}
